<template>
	<view  class="clearfix">
		<view class="list">
			<view class="item">
				<view class="img_wrap">
					<image class="img" :src="item.backUrl" mode="aspectFill"></image>
				</view>
				<view class="con">
					<view class="top">
						<view class="l">
							<image class="img" :src="item.logUrl" mode="aspectFill"></image>
						</view>
						<view class="r">
							<view class="typeName">{{item.bankName}}</view>
							<view>储蓄银行卡</view>
						</view>
					</view>
					<view class="bankNum">{{item.bankNum}}</view>
				</view>
			</view>
		</view>
		<uni-popup ref="popup" type="bottom">
			<view class="pop_close">
				<button class="btn btn1" @click="delCard">解除绑定</button>
				<button class="btn" @click="closePop">取消</button>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item: {}
			};
		},
		onLoad(options) {
			this.item =JSON.parse(options.obj);
		},
		onNavigationBarButtonTap(e) {
			this.$refs.popup.open()
		},
		methods:{
			//关闭弹窗
			closePop(){
				 this.$refs.popup.close()
			},
			//删除银行卡
			delCard() {
				let that = this;
				uni.showModal({
					title: '警告',
					content: "确定解绑此银行卡",
					success: (res)=> {
						if (res.confirm) {
							that.delCardById();
						} else if (res.cancel) {
							that.$refs.popup.close();
						}
					}
				})
			},
			delCardById(){
				this.$api.deleteBankCard(this.item.id).then(res=> {
					uni.showToast({
					    title: res.data.message,
					    duration: 1000,
						icon: "success",
						success:()=> {
							setTimeout(()=> {
								uni.navigateBack({
									animationDuration:2000
								})
							},1000)
						}
					});
				})
			}
				
		}
	}
</script>
<style>
	page{background: #F8F8F8;padding: 0 30rpx;box-sizing: border-box;}
</style>
<style lang="scss" scoped>
	.item{ height: 228rpx;position: relative;margin-top: 20rpx;color: white;
		.img_wrap{position: absolute;left: 0;top: 0;}
		.img_wrap,.img{width: 100%;height: 100%;}
		.con{position: relative;z-index: 99;
			.top{ display: flex;align-items: center;justify-content: space-between;padding-top: 40rpx;
				.l{width: 60rpx;height: 60rpx;margin:  0 40rpx ;}
				.r{flex: 1;}
			}
			.typeName{font-size: 32rpx;font-weight: bold;}
			.bankNum{margin-top: 30rpx;padding-left: 140rpx;}
		}
	}
	.pop_close{width: 100%;height: 240rpx;background: #FFFFFF;border-radius: 20rpx 20rpx 0 0 ; padding: 20rpx 30rpx;
		.btn{background: #FFFFFF;}
		.btn1{border-bottom: 2rpx solid #EEEEEE;}
		.btn::after{border: unset;}
	}
</style>
